import IQueue from "./IQueue";

class ArrayQueue<T> implements IQueue<T> {
  protected _data: T[] = [];
  enqueue(value: T): void {
    this._data.push(value);
  }
  dequeue(): T | undefined {
    return this._data.shift();
  }
  peek(): T | undefined {
    return this._data[0];
  }
  isEmpty(): boolean {
    return this._data.length === 0;
  }
  size(): number {
    return this._data.length;
  }
}

export default ArrayQueue;
